package com.sanzang.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.sanzang.interceptor.OneInterceptor;
import com.sanzang.interceptor.TwoInterceptor;

/**
 * 配置拦截器
 * @author sanzang
 *
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
	
	@Autowired
	OneInterceptor one;	
	@Autowired
	TwoInterceptor two;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(one).addPathPatterns("/**"); 
		registry.addInterceptor(two).addPathPatterns("/test/**","/admin/**"); 
	}
		
 
}
